<?php
	function getImageInfo($img) { //$img为图象文件绝对路径 
		$img_info = getimagesize($img); 
		switch ($img_info[2]) { 
		case 1: 
			$imgtype = "GIF"; 
			break; 
		case 2: 
			$imgtype = "JPG"; 
			break; 
		case 3: 
			$imgtype = "PNG"; 
			break; 
		} 
		$img_type = $imgtype."图像"; 
		$img_size = ceil(filesize($img)/1000)."k"; //获取文件大小 
	
		$new_img_info = array(
			"width"=>$img_info[0], 
			"height"=>$img_info[1], 
			"type"=>$img_type, 
			"size"=>$img_size 
		); 
		print " width: ".$img_info[0]."<br>"; 
		print " height: ".$img_info[1]."<br>"; 
		print " format: ".$img_type."<br>"; 
		print " size: ".$img_size."<br>"; 

		return $new_img_info; 
	} 
	
	$img="F:\\workspace\\dreamtale\\PHP\\Example100\\11-20\\45.gif"; 
	getImageInfo($img); 

?> 